package sunstar.com.xq.activity

import android.graphics.Typeface
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.geejoe.edgeslidingback.EdgeSlidingBackActivity
import kotlinx.android.synthetic.main.activity_base.*
import sunstar.com.xq.R
import sunstar.com.xq.util.DialogUtil

abstract class BaseActivity : EdgeSlidingBackActivity() {
    var dialoUtil : DialogUtil? = null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_base)
        setSupportActionBar(base_tool_bar)
        dialoUtil = DialogUtil(this)
        initView()
        base_title.text = setTitleText()
        if(showTitle()){
            base_tool_bar.visibility = View.VISIBLE
        }else{
            base_tool_bar.visibility = View.GONE
        }
        base_tool_bar.setNavigationOnClickListener {
            finish()
        }
        supportActionBar!!.setTitle("")
        var typeFace = Typeface.createFromAsset(assets, "fonts/qingkai.ttf")
        base_title.setTypeface(typeFace)
    }

    private fun initView() {
        base_body.addView(View.inflate(this,setBaseView(),null))
    }

    abstract fun setBaseView():Int
    abstract fun setTitleText():String
    abstract fun showTitle():Boolean

}
